import 'package:WebTest/chooseFood/core/model/category_model.dart';
import 'package:WebTest/chooseFood/ui/pages/meal/meal.dart';
import 'package:flutter/material.dart';
import '../../../../screenLayout/size_fit.dart';

class BDHomeCategoryItem extends StatefulWidget {
  final BDCategoryModel categoryModel;

  BDHomeCategoryItem(this.categoryModel);

  @override
  _BDHomeCategoryItemState createState() => _BDHomeCategoryItemState();
}

class _BDHomeCategoryItemState extends State<BDHomeCategoryItem> {
  @override
  Widget build(BuildContext context) {
    final bgColor = this.widget.categoryModel.cColor;
    return GestureDetector(
      onTap: (){
        Navigator.of(context).pushNamed(BDMealScreen.routerName,arguments: widget.categoryModel);
      },
      child: Container(
        child: Text(
          this.widget.categoryModel.title,
          style: Theme.of(context)
              .textTheme
              .headline2
              .copyWith(fontWeight: FontWeight.bold),
        ),
        decoration: BoxDecoration(
            color: bgColor,
            borderRadius: BorderRadius.circular(12.px),
            gradient: LinearGradient(colors: [bgColor.withOpacity(.5), bgColor])),
        alignment: Alignment.center,
      ),
    );
  }
}
